package cn.itsub.sodo.core.types;
/**
 * 点
 * @author loopcc
 *
 */
public class Vec2 {
	public float x ;
	public float y ;
	
	/* ---- ctor ---- */
	public Vec2() {

	}
	public Vec2(float x, float y) {
		this.x = x;
		this.y = y;
	}
	/* ---- Getters/Setters ---- */
	public float getX() {
		return x;
	}
	public void setX(float x) {
		this.x = x;
	}
	public float getY() {
		return y;
	}
	public void setY(float y) {
		this.y = y;
	}
	/* ---- SetValues ---- */
	public void set(Vec2 p){
		this.x = p.x;
		this.y = p.y;
	}
	public void set(float x,float y){
		this.x = x;
		this.y = y;
	}
	/* ---- StaticFactory ---- */
	public static Vec2 create(float x, float y){
		return new Vec2(x, y);
	}
	public static Vec2 zero(){
		return new Vec2(0,0);
	}
	/* ---- Others ---- */
	public boolean equals(Vec2 p) {
		return (p.x==x&&p.y==y);
	}
	@Override
	public String toString() {
		return String.format("Vec2[%.2f,%.2f]", x,y);
	}
}
